<?php $GLOBALS['script'][] = function() {?><script>
vue.data.form.vps_imageid = '';
vue.methods.changeOSName = function (event) {
    const OSName = jQuery(event.target).find("option:selected").text();
    vue.data.form.vps_osname = OSName;
    console.log(vue.data.form);
};
vue.methods.rebuild = function () {
    var msg = "重装系统将导致系统盘数据全部丢失！！！\r\n";
    msg += "↓↓↓您要重装系统的主机信息↓↓↓\r\n";
    if (vue.data.choice_hostuser.vps_wanipv4) {
        msg += "主机远程登录地址：" + vue.data.choice_hostuser.vps_wanipv4 + "\r\n";
    } else {
        msg += "主机远程登录地址：" + vue.data.choice_hostuser.rdpaddr + ":" + vue.data.choice_hostuser.rdpport + "\r\n";
        msg += "主机远程登录用户名：" + vue.data.choice_hostuser.username + "\r\n";
    }
    msg += "确定要【重装系统】吗？\r\n";
    if (confirm(msg)) {
        vue.data.form.action = 'rebuild';
        vue.methods.submit_operate();
    }
};
</script><?php }?>
<form class="form-horizontal" action="" method="post" v-on:submit="form.action='rebuild';rebuild();" onsubmit="return false;">
    <div class="box-body">
        <div class="form-group">
            <label for="qquin" class="col-sm-3 control-label">预留QQ号码</label>
            <div class="col-sm-9">
                <input type="text" class="form-control"
                id="qquin"
                v-model="form.qquin"
                :disabled="disabled>0"
                placeholder="预留QQ号码" />
            </div>
        </div>
        <div class="form-group" v-if="choice_hostuser['host_type']==2&&!choice_hostuser['stopped']">
            <label for="vps_imageid" class="col-sm-3 control-label">选择操作系统</label>
            <div class="col-sm-9">
                <select class="form-control" id="vps_imageid" required @change="changeOSName($event)" placeholder="1234"
                v-model="form.vps_imageid" v-if="choice_hostuser.host_id==321||choice_hostuser.host_id==322">
                    <option value="" disabled style="display:none;">请选择您要安装的操作系统</option>
                    <option value="centos_7_7_x64_20G_alibase_20200220.vhd">CentOS 7.7(阿里官方版)</option>
                    <option value="ubuntu_16_04_x64_20G_alibase_20200319.vhd">Ubuntu 16.04(阿里官方版)</option>
                    <option value="ubuntu_18_04_x64_20G_alibase_20200220.vhd">Ubuntu 18.04(阿里官方版)</option>
                </select>
                <select class="form-control" id="vps_imageid" required @change="changeOSName($event)"
                v-model="form.vps_imageid" v-if="choice_hostuser.host_id==323||choice_hostuser.host_id==324">
                    <option value="" disabled style="display:none;">请选择您要安装的操作系统</option>
                    <option value="win2008r2_sp1_x64_ent_zh-cn_40G_alibase_20200116.vhd">Windows 2008 R2 SP1 企业版(阿里官方版)</option>
                    <option value="win2012r2_9600_x64_dtc_zh-cn_40G_alibase_20200213.vhd">Windows 2012 R2 数据中心版(阿里官方版)</option>
                    <option value="win2019_1809_x64_dtc_zh-cn_40G_alibase_20200213.vhd">Windows 2019 数据中心版(阿里官方版)</option>
                    <option value="m-8vbie2viby7myruf7obx">Win2012R2飞儿云优化版</option>
                    <option value="m-8vb6evwfagx3oj7xd8b3">Win2019飞儿云优化版</option>
                    <option value="centos_7_7_x64_20G_alibase_20200220.vhd">CentOS 7.7(阿里官方版)</option>
                    <option value="ubuntu_16_04_x64_20G_alibase_20200319.vhd">Ubuntu 16.04(阿里官方版)</option>
                    <option value="ubuntu_18_04_x64_20G_alibase_20200220.vhd">Ubuntu 18.04(阿里官方版)</option>
                </select>
                <select class="form-control" id="vps_imageid" required @change="changeOSName($event)"
                v-model="form.vps_imageid" v-if="choice_hostuser.host_id==421">
                    <option value="" disabled style="display:none;">请选择您要安装的操作系统</option>
                    <option value="centos_7_7_x64_20G_alibase_20200220.vhd">CentOS 7.7(阿里官方版)</option>
                    <option value="ubuntu_16_04_x64_20G_alibase_20200220.vhd">Ubuntu 16.04(阿里官方版)</option>
                    <option value="ubuntu_18_04_x64_20G_alibase_20200220.vhd">Ubuntu 18.04(阿里官方版)</option>
                </select>
                <select class="form-control" id="vps_imageid" required @change="changeOSName($event)"
                v-model="form.vps_imageid" v-if="choice_hostuser.host_id==422">
                    <option value="" disabled style="display:none;">请选择您要安装的操作系统</option>
                    <option value="win2008_64_ent_r2_cn_40G_alibase_20160630.vhd">Win2008R2(阿里官方版)</option>
                </select>
                <select class="form-control" id="vps_imageid" required @change="changeOSName($event)"
                v-model="form.vps_imageid" v-if="choice_hostuser.host_id==3522||choice_hostuser.host_id==3523">
                    <option value="" disabled style="display:none;">请选择您要安装的操作系统</option>
                    <option value="win2012r2_9600_x64_dtc_zh-cn_40G_alibase_20200615.vhd">Windows 2012 R2 数据中心版(阿里官方版)</option>
                    <option value="win2019_1809_x64_dtc_zh-cn_40G_alibase_20200615.vhd">Windows 2019 数据中心版(阿里官方版)</option>
                    <option value="win2008r2_sp1_x64_ent_zh-cn_40G_alibase_20200116.vhd">Windows 2008R2 SP1 企业版(阿里官方版)</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="password" class="col-sm-3 control-label">设置新密码</label>
            <div class="col-sm-9">
                <input type="text" class="form-control"
                id="password"
                v-model="form.password"
                :disabled="disabled>0"
                placeholder="设置新的远程密码，必须包含大小写字母+数字" />
            </div>
        </div>
    </div>
    <div class="box-footer">
        <div class="box-footer col-sm-6 col-xs-12">
            <button type="submit" class="btn btn-info btn-block btn-flat" :disabled="disabled>0">确定重装系统</button>
        </div>
        <div class="box-footer col-sm-6 col-xs-12">
            <button type="button" class="btn btn-default btn-block btn-flat" v-on:click="tabclick('info')">返回详情</button>
        </div>
    </div>
</form>
